//
//  photoCellectionView.m
//  项目一TimeMovie
//
//  Created by apple on 16/4/7.
//  Copyright © 2016年 huangmingyu. All rights reserved.
//

#import "photoCellectionView.h"
#import "photoCell.h"

@implementation photoCellectionView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)init
{
   
    return [self initWithFrame:CGRectZero collectionViewLayout:[[UICollectionViewFlowLayout alloc] init]];
}

- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(nonnull UICollectionViewLayout *)layout
{
    self = [super initWithFrame:frame collectionViewLayout:layout];
    if (self ) {
        self.dataSource = self;
        self.delegate = self;
        
        self.pagingEnabled = YES;
        
        [self registerClass:[photoCell class] forCellWithReuseIdentifier:@"PhotoCellID"];
    }
    return self;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    
    return self.dataArray.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    
    photoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"PhotoCellID" forIndexPath:indexPath];
 
    cell.imgUrlStr = self.dataArray[indexPath.row];
    
    return cell;
}

@end
